package com.daohang.generator.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import com.daohang.dh.entity.MidpCusDetailsEntity;
import com.daohang.dh.manager.MidpCusDetailsManager;
import com.daohang.dh.service.MidpCusDetailsService;

/**
 * 客户信息表
 *
 * @author xiaomei
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018/05/23
 */
@Service("midpCusDetailsService")
public class MidpCusDetailsServiceImpl implements MidpCusDetailsService {

	@Autowired
	private MidpCusDetailsManager midpCusDetailsManager;

	@Override
	public Page<MidpCusDetailsEntity> listMidpCusDetails(Map<String, Object> params) {
		Query query = new Query(params);
		Page<MidpCusDetailsEntity> page = new Page<>(query);
		midpCusDetailsManager.listMidpCusDetails(page, query);
		return page;
	}

	@Override
	public R saveMidpCusDetails(MidpCusDetailsEntity role) {
		int count = midpCusDetailsManager.saveMidpCusDetails(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getMidpCusDetailsById(Long id) {
		MidpCusDetailsEntity midpCusDetails = midpCusDetailsManager.getMidpCusDetailsById(id);
		return CommonUtils.msg(midpCusDetails);
	}

	@Override
	public R updateMidpCusDetails(MidpCusDetailsEntity midpCusDetails) {
		int count = midpCusDetailsManager.updateMidpCusDetails(midpCusDetails);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = midpCusDetailsManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
